\(\int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx\) [282]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 48 \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-a^2 x-\frac {a^2 \cot (c+d x)}{d}-\frac {b^2 \cot (c+d x)}{d}-\frac {2 a b \csc (c+d x)}{d} \]

[Out]

-a^2*x-a^2*cot(d*x+c)/d-b^2*cot(d*x+c)/d-2*a*b*csc(d*x+c)/d

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3971, 3554, 8, 2686, 3852} \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {a^2 \cot (c+d x)}{d}+a^2 (-x)-\frac {2 a b \csc (c+d x)}{d}-\frac {b^2 \cot (c+d x)}{d} \]

[In]

Int[Cot[c + d*x]^2*(a + b*Sec[c + d*x])^2,x]

[Out]

-(a^2*x) - (a^2*Cot[c + d*x])/d - (b^2*Cot[c + d*x])/d - (2*a*b*Csc[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3971

Int[(cot[(c_.) + (d_.)*(x_)]*(e_.))^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Int[ExpandI
ntegrand[(e*Cot[c + d*x])^m, (a + b*Csc[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && IGtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (a^2 \cot ^2(c+d x)+2 a b \cot (c+d x) \csc (c+d x)+b^2 \csc ^2(c+d x)\right ) \, dx \\ & = a^2 \int \cot ^2(c+d x) \, dx+(2 a b) \int \cot (c+d x) \csc (c+d x) \, dx+b^2 \int \csc ^2(c+d x) \, dx \\ & = -\frac {a^2 \cot (c+d x)}{d}-a^2 \int 1 \, dx-\frac {(2 a b) \text {Subst}(\int 1 \, dx,x,\csc (c+d x))}{d}-\frac {b^2 \text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{d} \\ & = -a^2 x-\frac {a^2 \cot (c+d x)}{d}-\frac {b^2 \cot (c+d x)}{d}-\frac {2 a b \csc (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.62 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.81 \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {\left (a^2+b^2\right ) \cot (c+d x)+a (a (c+d x)+2 b \csc (c+d x))}{d} \]

[In]

Integrate[Cot[c + d*x]^2*(a + b*Sec[c + d*x])^2,x]

[Out]

-(((a^2 + b^2)*Cot[c + d*x] + a*(a*(c + d*x) + 2*b*Csc[c + d*x]))/d)

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 1.13 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.98

method result size
risch \(-a^{2} x -\frac {2 i \left (2 a b \,{\mathrm e}^{i \left (d x +c \right )}+a^{2}+b^{2}\right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}\) \(47\)
derivativedivides \(\frac {a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )-\frac {2 a b}{\sin \left (d x +c \right )}-b^{2} \cot \left (d x +c \right )}{d}\) \(49\)
default \(\frac {a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )-\frac {2 a b}{\sin \left (d x +c \right )}-b^{2} \cot \left (d x +c \right )}{d}\) \(49\)

[In]

int(cot(d*x+c)^2*(a+b*sec(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

-a^2*x-2*I*(2*a*b*exp(I*(d*x+c))+a^2+b^2)/d/(exp(2*I*(d*x+c))-1)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.92 \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {a^{2} d x \sin \left (d x + c\right ) + 2 \, a b + {\left (a^{2} + b^{2}\right )} \cos \left (d x + c\right )}{d \sin \left (d x + c\right )} \]

[In]

integrate(cot(d*x+c)^2*(a+b*sec(d*x+c))^2,x, algorithm="fricas")

[Out]

-(a^2*d*x*sin(d*x + c) + 2*a*b + (a^2 + b^2)*cos(d*x + c))/(d*sin(d*x + c))

Sympy [F]

\[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \cot ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(cot(d*x+c)**2*(a+b*sec(d*x+c))**2,x)

[Out]

Integral((a + b*sec(c + d*x))**2*cot(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.98 \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {{\left (d x + c + \frac {1}{\tan \left (d x + c\right )}\right )} a^{2} + \frac {2 \, a b}{\sin \left (d x + c\right )} + \frac {b^{2}}{\tan \left (d x + c\right )}}{d} \]

[In]

integrate(cot(d*x+c)^2*(a+b*sec(d*x+c))^2,x, algorithm="maxima")

[Out]

-((d*x + c + 1/tan(d*x + c))*a^2 + 2*a*b/sin(d*x + c) + b^2/tan(d*x + c))/d

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.67 \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {2 \, {\left (d x + c\right )} a^{2} - a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {a^{2} + 2 \, a b + b^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \]

[In]

integrate(cot(d*x+c)^2*(a+b*sec(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(2*(d*x + c)*a^2 - a^2*tan(1/2*d*x + 1/2*c) + 2*a*b*tan(1/2*d*x + 1/2*c) - b^2*tan(1/2*d*x + 1/2*c) + (a^
2 + 2*a*b + b^2)/tan(1/2*d*x + 1/2*c))/d

Mupad [B] (verification not implemented)

Time = 14.14 (sec) , antiderivative size = 58, normalized size of antiderivative = 1.21 \[ \int \cot ^2(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a-b\right )}^2}{2\,d}-\frac {\frac {a^2}{2}+a\,b+\frac {b^2}{2}}{d\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}-a^2\,x \]

[In]

int(cot(c + d*x)^2*(a + b/cos(c + d*x))^2,x)

[Out]

(tan(c/2 + (d*x)/2)*(a - b)^2)/(2*d) - (a*b + a^2/2 + b^2/2)/(d*tan(c/2 + (d*x)/2)) - a^2*x